package com.esri.core.map;

import com.esri.core.geometry.Geometry;
import com.esri.core.geometry.SpatialReference;
import com.esri.core.internal.util.d;
import com.esri.core.map.DataSource;
import java.io.StringWriter;
import org.codehaus.jackson.JsonGenerator;

/* loaded from: classes.dex */
public class QueryTableDataSource extends DataSource {
    private String a;
    private String b;
    private String c;
    private Geometry.Type d;
    private SpatialReference e;

    public QueryTableDataSource() {
        setType(DataSource.DataSourceType.queryTable);
    }

    public String getWorkspaceId() {
        return this.a;
    }

    public void setWorkspaceId(String str) {
        this.a = str;
    }

    public String getQuery() {
        return this.b;
    }

    public void setQuery(String str) {
        this.b = str;
    }

    public String getOidFields() {
        return this.c;
    }

    public void setOidFields(String str) {
        this.c = str;
    }

    public Geometry.Type getGeometryType() {
        return this.d;
    }

    public void setGeometryType(Geometry.Type type) {
        this.d = type;
    }

    public SpatialReference getSpatialReference() {
        return this.e;
    }

    public void setSpatialReference(SpatialReference spatialReference) {
        this.e = spatialReference;
    }

    @Override // com.esri.core.map.DataSource
    public String toJson() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a = d.a(stringWriter);
        a.writeStartObject();
        a.writeFieldName("type");
        a.writeString(getType().toString());
        a.writeStringField("workspaceId", getWorkspaceId());
        a.writeStringField("query", this.b);
        a.writeStringField("oidFields", this.c);
        a.writeStringField("geometryType", d.a(this.d));
        a.writeStringField("spatialReference", d.a(this.e));
        a.writeEndObject();
        a.close();
        return stringWriter.toString();
    }

    @Override // com.esri.core.map.DataSource
    public String toString() {
        return "QueryTableDataSource [" + super.toString() + ",id=" + this.a + ", query=" + this.b + ", oidFields=" + this.c + ", geometryType=" + this.d + ", spatialRef=" + this.e + "]";
    }
}
